Server-side dynamic elements produce HTML at run-time. This HTML is composed of the same HTML elements you use when you're creating a static web page. Like static elements, dynamic elements display formatted text, images, forms, hyperlinks, and active images. WebObjects provides several dynamic elements. For a complete list, see the online book Dynamic Elements Reference.
For an example of dynamic elements in action, consider an application whose first page contains a list of user choices of actions to perform. This page is shown in Figure 9.
This list could be hard-coded into an HTML page, but it is more extensible if it the list is produced using dynamic elements in a component. (Because this is the first component in the application, it is called Main.) Figure 10 shows how this same part of the page looks in WebObjects Builder.
Figure 10. Main Page in WebObjects Builder
The elements shown in Figure 10 are a WORepetition, a WOHyperlink, and a WOString. The WORepetition element corresponds to a for loop in C code. That is, it iterates through a list of items and, for each item in that list, prints its contents. In this example, the contents are a WOHyperlink and a WOString. The WOHyperlink is a hyperlink whose destination is determined at run-time, and the WOString is a string whose contents are determined at run-time.
As the name implies, server-side dynamic elements operate entirely on the server (see Figure 11). That is, when a server-side dynamic element is asked to draw itself, it produces HTML code that should form part of a page, the page is constructed, and then the entire page is sent from the server to the client. Later in this chapter, you'll learn about client-side components, which transport values and state from the server to the client and then draw themselves on the client machine.
Figure 11. Server-Side Dynamic Elements
Table of Contents
Next Section